<?php
session_start();
	//checkemail('tta@gmail.com');
		//session_destroy();
	signin('phoo@gmail.com','1234');
function checkemail($email){
	$connection=mysql_connect('localhost','root','');
	$slect_db = mysql_select_db('onestopjcu', $connection);
	$str = 'SELECT * FROM Member WHERE mem_email ="'.$email.'"';
	 $result = mysql_query ($str, $connection) or die();
	 $check = mysql_num_rows($result);
	 if($check > 0)
	 {
		return false;
	 }
	 else
	 {
		return true;
	 }
}


function signin($email, $pass){
		$connection=mysql_connect('localhost','root','');
		$slect_db = mysql_select_db('onestopjcu', $connection);
		$str = 'SELECT * FROM Member WHERE mem_email ="'.$email.'" AND mem_pword ="'.$pass.'"';
		$result = mysql_query ($str, $connection) or die();
		$check = mysql_num_rows($result);
	 if($check == 1)
	 {
		$record = mysql_fetch_row($result);
			$_SESSION['username'] = $record[1].' '.$record[2];
			
		//return true;
	 }
	 else
	 {
		echo "Hello World";
		//return false;
	 }
}
?>
